import sys
import stdio
def gcd(p,q):
    if q==0:
        return p
    return gcd(q,p%q)
def main():
    p=int(1440)
    q=int(408)
    stdio.writeln(gcd(p,q))


if __name__ == '__main__':
    main()